﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using RIO.Enum;

namespace RIO.Rooms
{
    internal class DiceDescriptor
    {
        public Point Position { get; set; }
        public Size Size { get; set; }
        public Dictionary<PlayerColor, int[]> Features { get; set; }
        public int Value { get; private set; }

        public DiceDescriptor()
        {
            Features = new Dictionary<PlayerColor, int[]>();
        }

        public bool TrySetValue(PlayerColor playerColor, int feature)
        {
            Value = 0;

            int[] colorFeature;
            if (!Features.TryGetValue(playerColor, out colorFeature))
                return false;


            for (int i = 0; i < colorFeature.Length; i++)
            {
                if (colorFeature[i] == feature)
                {
                    Value = i + 1;
                    return true;
                }
            }

            return false;
        }
    }
}
